<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>登录</title>
    <link rel="stylesheet" type="text/css" media="all" href="/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" media="all" href="/css/my.css" />
    <script type="text/javascript" src="/layui/layui.all.js"></script>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/myJs.js"></script>

</head>
<body style="background-color:#f6f6f6; background-image:url(../static/images/login.jpg)" >
<style>
    .biankuang{
        border:2px solid #a1a1a1;

        background:#fff9ec;
        width:280px;
        height: 300px;
        padding: 40px;
        border-radius:25px;
    }
    .ziti{
        font-size: 20px;
        font-family: "Droid Sans Mono";
        font-weight: bold;
        top: 30px;
        color:#d9534f;
        height: 20px;
    }
    .fixed{ position:fixed; left:0px; bottom:0px; width:100%; height:50px; background: #bce8f1; z-index:9999;}
</style>
<div class="header " style="height: 110px;background: #bce8f1;"><BR/><BR/><div align="center" class=" ziti"><img src="/images/wodalog.jpg" height="50" width="50"/> 我 的 打 工 网 | 资 源 平 台</div></div>

<div align="center">
    <br/><br/><br/><br/>
    <br/><br/><br/><br/>
    <form  id="Login_form" name="form" class="biankuang">
        <br/><br/>
        <div style="font-family: 'Microsoft New Tai Lue'; color: #1E9FFF ;font-weight: bold;font-size: 22px">   欢  迎  使  用</div><br/>

        <div class="layui-form-item">
            <input type="text" name="loginName" id="loginName" style="width: 260px" required="required" autocomplete="off" placeholder="用户名" class="layui-input" />
        </div>
        <div>
            <input type="password" name="password" id="password" style="width: 260px" required="required" autocomplete="off" placeholder="密码" class="layui-input" />
        </div>
    <br/>
        <div>
            <button type="reset" class="layui-btn " style="width: 260px ;background-color: #f0ad4e" lay-filter="login_bt" id="login_bt" lay-submit="">登录</button>
        </div>
    </form>

</div>
<div class="fixed " align="center" style="font-family: 楷体"><br/>技术支持-上海达家迎测试部</div>
<script>

    function serializeObject(form){
        var o ={};
        $.each(form.serializeArray(),function(index){
            if(o[this['name']]){
                o[this['name']] = o[this['name']] +","+this['value'];

            }else{
                o[this['name']] = this['value'];
            }
        });
        return o;
    }
    layui.use('form', function(){
        var form = layui.form;
        form.render();
        //监听提交
        form.on('submit(login_bt)', function(data){
            var a = document.getElementById("loginName").value;
            var from= $("#Login_form");
            var model= serializeObject(from);
            $.ajax({
                type: "post",
                url: "/Request/userLogin",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify(model),
                dataType: "json",
                success:function(data) {
                    if (data =="fail") {
                        layer.alert("用户名密码错误")
                    }else if (data =="fails"){
                        layer.alert("无此用户")
                    }else {
                        var storage = window.localStorage;
                        storage.clear();
                        storage["power"] = data;
                        storage["username"] =a ;
                        loadPage("/plateForm/homepage");
                    };
                }
            })
        });
    });
</script>
</body>
</html>